package com.jennifer.andy.androidxlazyload

import android.animation.ValueAnimator
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.animation.doOnEnd
import com.jennifer.andy.androidxlazyload.util.ChatKeyboardUtil
import java.util.Observer

class ChatInputFragment : LazyFragment() {


    companion object {
        const val FROM_WHICH_ACTIVITY = "from_which_activity"

        @JvmStatic
        fun newInstance(
        ): ChatInputFragment {
            val bundle = Bundle()
            val fragment = ChatInputFragment()
            fragment.arguments = bundle
            return fragment
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view: View =
            inflater.inflate(R.layout.sport_fragment_event_chat_input, container, false)
//        activity?.let {
            ChatKeyboardUtil.registerSoftInputActivity(requireActivity())
//        }
        return view
    }

    override fun lazyInit() {
        initListener()
    }


    fun initListener() {
        ChatKeyboardUtil.onSoftInputChange.observe(viewLifecycleOwner) { height ->

//            context?.let {
                Log.e("键盘弹出监听结果", "xxxxxx    $height")
//            }
        }
    }


    override fun onDestroyView() {
        super.onDestroyView()
//        activity?.let {
            ChatKeyboardUtil.removeSoftInputActivity(requireActivity())
//        }
    }


}